package com.v5ba.nacos.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.v5ba.nacos.config.AppleConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yiren
 * @since 2022/5/4
 */
@RestController
public class DemoController {
    @NacosValue(value ="${age:0}")
    private Integer age;
    @Autowired
    private AppleConfig appleConfig;

    @GetMapping("age/age")
    public Integer getAge(){
        System.out.println("========="+appleConfig.getName());
        return age;
    }
}
